/*
 * OneEntry.cpp
 *
 * Created on: 05-05-2014
 *     Author: A.W. Janisse
 *
 * Version 1.0: 24-05-2014, Final release
 */

#include "OneEntry.h"

OneEntry::OneEntry(int x, int y, string type)
:Gate(x, y, type), entry(NULL)
{
}

Gate * OneEntry::getEntry(int nr)
{
    if(nr == 0)
        return entry;
    else
        return NULL;
}

bool OneEntry::connectEntryTo(Gate *gate)
{
   if(entry == NULL){
       entry = gate;
       return true;
   }
   else
        return false;
}

bool OneEntry::removeEntryTo(Gate *gate)
{
    if(entry != NULL && entry->getNumber() == gate->getNumber()){
        entry = NULL;
        return true;
    } else
        return false;
}

